﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using Microsoft.Win32.SafeHandles;
using OpenSoftStore.Orm;
using OpenSoftStore.Orm.Model;

namespace OpenSoftStore.BusinessLogic.Common
{
    public class ComboLogic : ABusinessLogic
    {
        #region Methods

        public IEnumerable<T_Combo> GetComboByBuzType(string buzType = "", string shopId = "")
        {
            string where = "";
            if (!string.IsNullOrEmpty(buzType)) where = "BuzType='" + buzType + "' ";
            if (!string.IsNullOrEmpty(shopId)) where += " and ShopId='" + shopId + "' ";
            where += " Order by OrderNum asc";
            var data = Spa.Where<T_Combo>(where);
            return data;
        }

        public int UpdateCombo(List<T_Combo> comboList)
        {

            Spa.UpdateObjects(comboList);
            return Spa.SaveChanges();
        }

        #endregion
    }
}

